<?php
/**
 * GKPHP - 极客框架
 * GK函数助手 V1.0
 */
use GK\App;
use GK\Cache;
use GK\Url;
use GK\Model;
use GK\Json;
use GK\Request;
use GK\Exception\NumberException;
if (!function_exists('Url')){
    function Url($Url='',$Value='',$Suffix=false,$Domain=false){
        return Url::Build($Url,$Value,$Suffix,$Domain);
    }
}
if (!function_exists('Model')){
    function DB($Name='Mysql'){
        return new Model($Name);
    }
}
if (!function_exists('Request')){
    function Request(){
        return new Request();
    }
}
if (!function_exists('Json')){
    function Json(){
        return Json::getInstance();
    }
}
if (!function_exists('NumberException')){
    function Number($Name='UID'){
        return NumberException::{$Name}();
    }
}
//便捷控制器调用
function C($Controllers){
    $Controller='\\App\\'.App::$Module.'\\Controller\\'.$Controllers;
    if(!empty(App::$Config['AppConfig']['controller_suffix'])){
        $Controller=$Controller.App::$Config['AppConfig']['controller_suffix'];
    }
    return new $Controller();
}
//快捷公共方法调用
function F($Common,$Module=''){
    if(empty($Module))$Module=App::$Module;
    $Common='\\App\\'.$Module.'\\Common\\'.$Common;
    return new $Common();
}
function M($Model,$Module=''){
    if(empty($Module))$Module=App::$Module;
    $Model='\\App\\'.$Module.'\\Model\\'.$Model;
    return new $Model();
}
function P($var){
    if(is_bool($var)){
        var_dump($var);
    }elseif(is_null($var)){
        var_dump(NULL);
    }else{
        echo "<pre style='position:relative;z-index:999;padding:10px;border-radius:5px;background:#ccc;border:1px solid #aaa;font-zize:14px;line-height:18px;opacity:0.9;'>".print_r($var,true)."</pre>";
    }
}
